import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type {
  VideoDanmakuVO,
  VideoDanmakuForm,
  VideoDanmakuQuery,
} from "@/api/videoDanmaku/types";

/**
 * 查询视频弹幕列表
 * @param query
 * @returns {*}
 */

export const listVideoDanmaku = (
  query?: VideoDanmakuQuery
): AxiosPromise<VideoDanmakuVO[]> => {
  return request({
    url: "/business/videoDanmaku/list",
    method: "get",
    params: query,
  });
};

/**
 * 查询视频弹幕详细
 * @param id
 */
export const getVideoDanmaku = (
  id: string | number
): AxiosPromise<VideoDanmakuVO> => {
  return request({
    url: "/business/videoDanmaku/" + id,
    method: "get",
  });
};

/**
 * 新增视频弹幕
 * @param data
 */
export const addVideoDanmaku = (
  data: VideoDanmakuForm
): AxiosPromise<VideoDanmakuVO> => {
  return request({
    url: "/business/videoDanmaku",
    method: "post",
    data: data,
  });
};

/**
 * 修改视频弹幕
 * @param data
 */
export const updateVideoDanmaku = (data: VideoDanmakuForm) => {
  return request({
    url: "/business/videoDanmaku",
    method: "put",
    data: data,
  });
};

/**
 * 删除视频弹幕
 * @param id
 */
export const delVideoDanmaku = (
  id: string | number | Array<string | number>
) => {
  return request({
    url: "/business/videoDanmaku/" + id,
    method: "delete",
  });
};
